package _07Stream流常用方法;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Stream;

public class DemoStream_map {

    public static void main(String[] args) {
        //map方法  转换类型
        Stream<String> streamMap = Stream.of("11", "22", "33", "44");

        Stream<Integer> integerStream = streamMap.map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                return Integer.parseInt(s);
            }
        });

        integerStream.forEach(new Consumer<Integer>() {
            @Override
            public void accept(Integer integer) {
                System.out.println(integer);
            }
        });


    }

}
